<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>

    <style>
        .mya {
            color: red;
            font-size: 30px;
        }
    </style>

    <script>
        window.onload = function() {
            var oInput = document.getElementById("uid");
            // alert(oInput);
            // 对象获取成功后对属性获取
            var name = oInput.name;
            console.log(name);
            var value = oInput.value;
            console.log(value);

            var oA = document.getElementById("link1");
            // oA.style.color = 'red';
            // oA.style.fontSize = '30px';
            oA.className = "mya";
        };
    </script>
</head>
<body>
    <input type="text" name="username" id="uid" value="李四">
    <a href="http://www.baidu.com" id="link1">百度</a>
</body>
</html>